package com.sri.controller.login;

import com.sri.system.SessionManager;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * @author skodali
 * 
 */
public class LogoutAction {

  /**
   * Method logout Logout the user, even if the user clicks the close icon of
   * his client browser.
   * 
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return ActionForward
   */
  public ActionForward signout(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
    // clean the session
    SessionManager.sessionManager(request);
    // invalidate the session
    request.getSession(false).invalidate();
    // Navigate the user to login page
    return mapping.findForward("success");
  }

}
